<!-- 变更 -->
<template>
    <el-dialog title="输入课题编号" :visible.sync="dialogKT" width="60%" >
        <div class="my-form-container" style="height:62px">
            <el-form ref="ruleForm" :model="ruleForm" :rules="rules" class="demo-ruleForm">
            <el-row class="my-form-item" style="border: none;">
                <el-col :span="24">
                <div class="my-form-item-label">课题编号</div>
                <el-form-item  prop="docno">
                    <div class="my-form-item-value">
                    <el-input class="inputWidth" v-model="ruleForm.subjectId"></el-input>
                    </div>
                </el-form-item>
                </el-col>
            </el-row>
            </el-form>
        </div>
        <div class="button-group">
        <div class="" @click="saveNum">保存</div>
        <div class="" @click="dialogKT=false">取消</div>
        </div>
    </el-dialog>
</template>
<script>
import {updateNum} from "@/api/teachingTopic";

export default {
  data() {
    return {
      dialogKT:false,
      rules: {
        subjectId: [
          { required: true, message: '课题编号不能为空', trigger: 'blur' }
        ]
      },
      ruleForm:{
        fillId:'',
        subjectId:''
      },
    };
  },
  props:{
	  fillId:String,
    subjectId:String
  },
  watch:{
    fillId(val){
      if(val){
        this.ruleForm.fillId = val;
        this.ruleForm.subjectId = this.subjectId;
      }
    }
  },
  mounted(){
  },
  methods: {
    saveNum(){
        this.$refs['ruleForm'].validate(async(valid) => {
          if (valid) {
              let res = await updateNum(this.ruleForm);
              if(res.code == 200){
                this.dialogKT = false;
                this.$emit('updateNum')
              }
          } 
        });
      }
  },
};
</script>
<style lang="less" scoped>
@import "../../../styles/commonCss.less";
  /deep/.demo-ruleForm{
        .el-form-item{
            margin-bottom: 0!important;
            width: 100%;
        }
        .el-form-item__error {
            top: 75%;
            left: 42px;
        }
    }
     /deep/.my-form-item-label{justify-content: center;padding: 0!important;}
     .my-form-container{
        width:85%;
        margin: 20px auto 0;
     }
     .inputWidth{width: 220px;}
     .button-group{padding-bottom: 40px;}
</style>